Getting Started with WPF | ComponentOne Studio Edition
Theming / Implicit and Explicit Styles / Using the ImplicitStyleManager
In This Topic
    Using the ImplicitStyleManager
    In This Topic

    The ImplicitStyleManager lets you set styles implicitly in Silverlight as you might in WPF. You can find the ImplicitStyleManger in the System.Windows.Controls.Theming.Toolkit.dll assembly installed with the Silverlight Toolkit.

    To use the ImplicitStyleManager add a reference in your project to the System.Windows.Controls.Theming.Toolkit.dll assembly and add its namespace to the initial UserControl tag as in the following markup:

    XAML
    Copy Code
    <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:c1="clr-namespace:C1.Silverlight;assembly=C1.Silverlight" 
    xmlns:theming="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.Toolkit" 
    x:Class="C1Theming.MainPage" Width="640" Height="480">
    

    Once you've added the reference and namespace you can use the ImplicitStyleManager in your application. For example, in the following markup a style is added and implicitly implemented:

    XAML
    Copy Code
    <Grid x:Name="LayoutRoot" Background="White" theming:ImplicitStyleManager.ApplyMode="OneTime">
        <Grid.Resources>
            <Style TargetType="c1:C1DropDown">
                < Setter Property="Background" Value="Red" />
            < /Style>
    
        </Grid.Resources> 
        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
            < c1:C1DropDown Margin="5" Content="C1DropDown" Height="30" Width="100"/>
        </StackPanel>
    </Grid>
    
    See Also